package design.mode.model.builder.expand;

/**
 * @author ldanniel
 * @description
 * @date 2023/21/21:11
 * @since jdk11
 */
public class PhoneExpand {
    private String cpu;
    private String screen;
    private String memory;
    private String mainBoard;

    public PhoneExpand(Builder builder) {
        this.cpu = builder.cpu;
        this.screen = builder.screen;
        this.memory = builder.memory;
        this.mainBoard = builder.mainBoard;
    }

    @Override
    public String toString() {
        return "PhoneExpand{" +
                "cpu='" + cpu + '\'' +
                ", screen='" + screen + '\'' +
                ", memory='" + memory + '\'' +
                ", mainBoard='" + mainBoard + '\'' +
                '}';
    }

    /**
     * 建造者（内部类）
     */
    public static final class Builder {
        private String cpu;
        private String screen;
        private String memory;
        private String mainBoard;

        public Builder cpu(String cpu) {
            this.cpu = cpu;
            return this;
        }

        public Builder screen(String screen) {
            this.screen = screen;
            return this;
        }

        public Builder memory(String memory) {
            this.memory = memory;
            return this;
        }

        public Builder mainBoard(String mainBoard) {
            this.mainBoard = mainBoard;
            return this;
        }

        /**
         * 使用创建者构建PhoneExpand对象
         *
         * @return
         */
        public PhoneExpand build() {
            return new PhoneExpand(this);
        }
    }
}
